package com.botao.tip.utils;


/**
 * @author cbt28
 */
public class AjaxResult {
    private int code;
    private Object data;
    private String msg;

    private AjaxResult(int code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public static AjaxResult success(Object data) {
        return new AjaxResult(0, data, "操作成功");
    }

    public static AjaxResult success() {
        return success(null);
    }

    public static AjaxResult error(int code, String errors) {
        return new AjaxResult(code, null, errors);
    }

    public static AjaxResult error(String errors) {
        return new AjaxResult(-1, null, errors);
    }

    public static AjaxResult error() {
        return error("操作失败");
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
